<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>下订单 - 商城</title>
		<%@ include file="/common/include/title.jsp"%>
	</head>
	<body>
		<%-- <%@ include file="/common/include/header.jsp"%> --%>
		<%-- 如果包含的页面中数据是活的,需要访问Contrller查询数据库只能使用动态包含 --%>
		<!-- 动态包含可以带参数?相当于?后面的内容
				header.html?cateIdTemp=${requestScope.cateId}
			 -->
		<jsp:include page="/header.html">
			<jsp:param value="${requestScope.cateId}" name="cateIdTemp"/>
		</jsp:include>
		<div id="mainBody">
			<div class="container">
				<div class="row">
					<!-- Sidebar ================================================== -->
					<div id="sidebar" class="span3">
						<div class="well well-small">
							<a id="myCart" href="product_summary.html"><img
								src="themes/images/ico-cart.png" alt="cart">3 Items in your
								cart <span class="badge badge-warning pull-right">$155.00</span></a>
						</div>
						<ul id="sideManu" class="nav nav-tabs nav-stacked">
							<li class="subMenu open"><a> ELECTRONICS [230]</a>
								<ul>
									<li><a class="active" href="products.html"><i
											class="icon-chevron-right"></i>Cameras (100) </a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Computers, Tablets & laptop
											(30)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Mobile Phone (80)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Sound & Vision (15)</a></li>
								</ul></li>
							<li class="subMenu"><a> CLOTHES [840] </a>
								<ul style="display: none">
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Women's Clothing (45)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Women's Shoes (8)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Women's Hand Bags (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Men's Clothings (45)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Men's Shoes (6)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Kids Clothing (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Kids Shoes (3)</a></li>
								</ul></li>
							<li class="subMenu"><a>FOOD AND BEVERAGES [1000]</a>
								<ul style="display: none">
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Angoves (35)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Bouchard Aine & Fils (8)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>French Rabbit (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Louis Bernard (45)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>BIB Wine (Bag in Box) (8)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Other Liquors & Wine (5)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Garden (3)</a></li>
									<li><a href="products.html"><i
											class="icon-chevron-right"></i>Khao Shong (11)</a></li>
								</ul></li>
							<li><a href="products.html">HEALTH & BEAUTY [18]</a></li>
							<li><a href="products.html">SPORTS & LEISURE [58]</a></li>
							<li><a href="products.html">BOOKS & ENTERTAINMENTS [14]</a></li>
						</ul>
						<br />
						<div class="thumbnail">
							<img src="themes/images/products/panasonic.jpg"
								alt="Bootshop panasonoc New camera" />
							<div class="caption">
								<h5>Panasonic</h5>
								<h4 style="text-align: center">
									<a class="btn" href="product_details.html"> <i
										class="icon-zoom-in"></i></a> <a class="btn" href="#">Add to <i
										class="icon-shopping-cart"></i></a> <a class="btn btn-primary"
										href="#">$222.00</a>
								</h4>
							</div>
						</div>
						<br />
						<div class="thumbnail">
							<img src="themes/images/products/kindle.png"
								title="Bootshop New Kindel" alt="Bootshop Kindel">
							<div class="caption">
								<h5>Kindle</h5>
								<h4 style="text-align: center">
									<a class="btn" href="product_details.html"> <i
										class="icon-zoom-in"></i></a> <a class="btn" href="#">Add to <i
										class="icon-shopping-cart"></i></a> <a class="btn btn-primary"
										href="#">$222.00</a>
								</h4>
							</div>
						</div>
						<br />
						<div class="thumbnail">
							<img src="themes/images/payment_methods.png"
								title="Bootshop Payment Methods" alt="Payments Methods">
							<div class="caption">
								<h5>Payment Methods</h5>
							</div>
						</div>
					</div>
					<!-- Sidebar end=============================================== -->
					<form method="post" action="${rootPath }/head/orders/ordersInsertSubmit.html">
						<div class="span9">
							<ul class="breadcrumb">
								<li><a href="${rootPath }/main.html">首页</a>
								<span class="divider">/</span></li>
								<li class="active">订单结算页</li>
							</ul>
							<h3>
								订单结算页
								<a href="${rootPath }/goods.html" class="btn btn-large pull-right">
									<i class="icon-arrow-left"></i>
									继续购物
								</a>
							</h3>
							<hr class="soft" />
							<table class="table table-bordered">
								<tr>
									<th>请选择收货地址</th>
								</tr>
								<tr>
									<td>
										<c:forEach items="${requestScope.usersAddressList}" var="usersAddress" varStatus="stat">
											<div class="control-group">
												<div class="controls">
													<label for="usersAddress_${usersAddress.id }">
														<input id="usersAddress_${usersAddress.id }" type="radio" name="addressId" value="${usersAddress.id }" ${usersAddress.isDef == '1' ? 'checked' : '' }>
														&nbsp;&nbsp;${stat.count },${usersAddress.name },
														${usersAddress.contact },${usersAddress.phone },${usersAddress.address },
														${usersAddress.zipCode },${usersAddress.name },
													</label>
												</div>
											</div>
										</c:forEach>
									</td>
								</tr>
							</table>
		
							<table class="table table-bordered">
								<thead>
									<tr>
										<th>序号</th>
										<th>商品</th>
										<th>名字</th>
										<th>数量</th>
										<th>市场价</th>
										<th>折扣后价</th>
										<th>总价格</th>
									</tr>
								</thead>
								<tbody>
									<%--
										for(int stat = 0 ; stat < usersCarList.size(); stat ++)
										{
											usersCar = usersCarList.get(stat);
											
										}
									 --%>
									<c:set value="0" var="totalMarketPrice"/>
									<c:set value="0" var="totalZhePrice"/>
									<c:forEach items="${requestScope.usersCarList }" var="usersCar" varStatus="stat">
										<!-- 设置值 -->
										<c:set value="${totalMarketPrice +  usersCar.goods.marketPrice * usersCar.num}" var="totalMarketPrice"/>
										<c:set value="${totalZhePrice +  (usersCar.goods.marketPrice - usersCar.goods.price) * usersCar.num}" var="totalZhePrice"/>
										<!-- 存储购物车的相关信息 -->
										<input type="hidden" name="usersCarIds" value="${usersCar.id}"/>
										
										<tr>
											<td>
												${stat.count }
											</td>
											<td>
												<a href="${rootPath }/goods/${usersCar.goods.url}.html" target="_blank">
													<c:choose>
														<c:when test="${usersCar.goods.listImgPath != null && usersCar.goods.listImgPath!= ''}">
															<img title="${usersCar.goods.name }" src="${usersCar.goods.listImgPath}" alt=""  height="60" width="60"/>
														</c:when>
														<c:otherwise>
															<img title="${usersCar.goods.name }" src="${rootPath }/imgs/no_pic.gif" alt="" height="60" width="60"/>
														</c:otherwise>
													</c:choose>
												</a>
											</td>
											<td title="${usersCar.goods.name }">
												<a href="${rootPath }/goods/${usersCar.goods.url}.html" target="_blank">
													${fn:substring(usersCar.goods.name,0,20)}<br />
													<!-- Color : black, Material : metal -->
												</a>
											</td>
											<td>
												${usersCar.num}
											</td>
											<td>Y${usersCar.goods.marketPrice }</td>
											<td>Y${usersCar.goods.price }</td>
											<td>Y${usersCar.goods.price * usersCar.num}</td>
										</tr>
									</c:forEach>
									<!-- 总计的价格只能是在循环的时候计算 -->
									<tr>
										<td colspan="6" style="text-align: right">总市场价:</td>
										<td>Y${totalMarketPrice}</td>
									</tr>
									<tr>
										<td colspan="6" style="text-align: right">总折扣:</td>
										<td>Y${totalZhePrice }</td>
									</tr>
									<tr>
										<td colspan="6" style="text-align: right">
											<strong>
												共计:(Y${totalMarketPrice} - Y${totalZhePrice }) =
											</strong>
										</td>
										<td class="label label-important" style="display: block">
											<strong> Y${totalMarketPrice - totalZhePrice } </strong>
										</td>
									</tr>
								</tbody>
							</table>
		
							<table class="table table-bordered">
								<tr>
									<th>订单备注</th>
								</tr>
								<tr>
									<td>
										<div class="control-group">
											<label class="control-label" for="inputCountry">备注
											</label>
											<div class="controls">
												<input type="text" name="note" id="note" placeholder="备注">
											</div>
										</div>
									</td>
								</tr>
							</table>
							<a href="${rootPath }/goods.html" class="btn btn-large">
								<i class="icon-arrow-left"></i>
								继续购物
							</a>
							<button type="submit" class="btn btn-large pull-right">
								提交订单
								<i class="icon-arrow-right"></i>
							</button>
						</div>
					</form>
				</div>
			</div>
		</div>
		<!-- MainBody End ============================= -->
		<%@ include file="/common/include/footer.jsp"%>
	</body>
</html>